package id.net.iconpln.bb.client.view;

import id.net.iconpln.bb.client.model.BbMasterPemasokBean;
import id.net.iconpln.bb.client.model.BbMstPembangkitBean;
import id.net.iconpln.bb.client.service.BatubaraService;
import id.net.iconpln.bb.client.service.BatubaraServiceAsync;

import java.util.ArrayList;
import java.util.List;

import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.Orientation;
import com.extjs.gxt.ui.client.binding.FormBinding;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.util.IconHelper;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.DateField;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
import com.extjs.gxt.ui.client.widget.layout.FitData;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.extjs.gxt.ui.client.widget.layout.RowData;
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
import com.extjs.gxt.ui.client.widget.toolbar.LabelToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.rpc.AsyncCallback;

public class PageBbPJBB_REE extends LayoutContainer {
	private final BatubaraServiceAsync rkapService = GWT.create(BatubaraService.class);
	Grid<BbMasterPemasokBean> grid;
	Grid<BbMstPembangkitBean> gridkit;
	Grid<BbMasterPemasokBean> grid2;
	Grid<BbMasterPemasokBean> grid1;
	ListStore<BbMstPembangkitBean> store1;
	ListStore<BbMasterPemasokBean> store;
	ListStore<BbMasterPemasokBean> store2;
	ListStore<BbMasterPemasokBean> store3;
	private FormData formData;
	private FormBinding formBindings;
	ToolBar toolbar = new ToolBar();
	ToolBar toolbar1 = new ToolBar();
	ToolBar toolbar2 = new ToolBar();
	ToolBar toolbar3 = new ToolBar();
	private List<BbMstPembangkitBean> datakit;
	private List<BbMasterPemasokBean> datapemasok;
	
	List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
     ColumnConfig idpltu = new ColumnConfig();
     ColumnConfig idpemasok = new ColumnConfig();
     ColumnConfig lot = new ColumnConfig();
     ColumnConfig kebtahun = new ColumnConfig();
     ColumnConfig ket = new ColumnConfig();
     ColumnConfig nopjbb = new ColumnConfig();
     ColumnConfig tglpjbb = new ColumnConfig();
     ColumnConfig volpjbb = new ColumnConfig();
     ColumnConfig volpjbbtahun = new ColumnConfig();
     ColumnConfig hargarpton = new ColumnConfig();
     ColumnConfig hargapenyesuaian = new ColumnConfig();
     ColumnConfig rpnilaikontrak = new ColumnConfig();
     ColumnConfig kalori = new ColumnConfig();
     ColumnConfig masaberlaku = new ColumnConfig();
     ColumnConfig jenispengiriman = new ColumnConfig();
     ColumnConfig jaminanbank = new ColumnConfig();
     Button btinsert;
     Button btupdate;
     Button btdelete;
     Button btcetak;
	
	@Override
	  protected void onRender(Element parent, int pos) {
	    super.onRender(parent, pos); 
	    setLayout(new FitLayout());  
	    
	    DateTimeFormat dt = DateTimeFormat.getFormat("dd/MM/YYYY");
	    formData = new FormData("-20");
	    ContentPanel cp = new ContentPanel();  
	    cp.setHeading("Kontrak PJBB");  
	    cp.setFrame(true);  
	    cp.setSize(1030, 600);  
	    cp.setLayout(new RowLayout(Orientation.HORIZONTAL));  
	  
	    
	    grid = createGrid();
	    grid1 = createGrid1();
	    gridkit = createGridkit();
	    grid2 = createGrid2();
	  
	    
	    ContentPanel pan = new ContentPanel();
	    pan.setHeaderVisible(false);
	    pan.setLayout(new FitLayout());
	    pan.add(grid);
	    toolbar1.add(new LabelToolItem("Jangka Panjang"));
	    toolbar1.add(new SeparatorToolItem());
	    pan.setTopComponent(toolbar1);
	    
	    ContentPanel pan1 = new ContentPanel();
	    pan1.setHeaderVisible(false);
	    pan1.setLayout(new FitLayout());
	    pan1.add(grid1);
	    toolbar2.add(new LabelToolItem("Menengah"));
	    toolbar2.add(new SeparatorToolItem());
	    pan1.setTopComponent(toolbar2);
	    
	    ContentPanel pan3 = new ContentPanel();
	    pan3.setHeaderVisible(false);
	    pan3.setLayout(new FitLayout());
	    pan3.add(grid2);
	    toolbar3.add(new LabelToolItem("Spot"));
	    toolbar3.add(new SeparatorToolItem());
	    pan3.setTopComponent(toolbar3);
	    
	    ContentPanel panel = new ContentPanel();
	    panel.setHeaderVisible(false);
	    panel.setLayout(new RowLayout(Orientation.VERTICAL));
	    panel.add(pan, new RowData(1, .3));
	    panel.add(pan1, new RowData(1, .3));
	    panel.add(pan3, new RowData(1, .4));
	    
	    btinsert = new Button("Simpan", new SelectionListener<ButtonEvent>() {  
		      @Override  
		      public void componentSelected(ButtonEvent ce) {
		    	 
		      }  
		    });  
		    
      btinsert.setIcon(IconHelper.createStyle("icon-reza-add"));
      
      btupdate = new Button("Ubah", new SelectionListener<ButtonEvent>() {  
		      @Override  
		      public void componentSelected(ButtonEvent ce) {
		    	  
		      }  
		    });  
	   btupdate.setIcon(IconHelper.createStyle("icon-reza-edit"));
	   
	   btdelete = new Button("Delete", new SelectionListener<ButtonEvent>() {  
		      @Override  
		      public void componentSelected(ButtonEvent ce) {
		    	  
		      }  
		    });  
	   btdelete.setIcon(IconHelper.createStyle("icon-reza-delete"));
	    

	   btcetak = new Button("Cetak", new SelectionListener<ButtonEvent>() {  
		      @Override  
		      public void componentSelected(ButtonEvent ce) {
		    	  
		      }  
		    });  
	   btcetak.setIcon(IconHelper.createStyle("icon-printer"));
	   
	    ContentPanel cppasokan = new ContentPanel();
	    cppasokan.setHeaderVisible(false);
	    cppasokan.add(gridkit);
	    cppasokan.setLayout(new FitLayout());
	    toolbar.add(new LabelToolItem("Daftar Pembangkit"));
	    toolbar.add(new SeparatorToolItem());
	    toolbar.add(btcetak);
	    cppasokan.setTopComponent(toolbar);
	    
	    ContentPanel delimeter = new ContentPanel();
	    delimeter.setHeaderVisible(false);
	    delimeter.setWidth(10);
	    
	    cp.add(panel, new RowData(.4, 1));  
	    cp.add(delimeter, new FitData(5));
	    cp.add(cppasokan, new RowData(.6, 1));
	    add(cp, new FitData(5)); 
	  }  
	  
	private Grid<BbMstPembangkitBean> createGridkit() {  
	    
		final List<ColumnConfig> columns = new ArrayList<ColumnConfig>(); 
	    
		store1 = new ListStore<BbMstPembangkitBean>();
		
		getdataKit();
		
//		store1.setMonitorChanges(true);  
//	    store1.add(TestData.getMstPembangkit()); 
		
		RowNumberer id = new RowNumberer();  
	    id.setWidth(30);
	    
	    ColumnConfig nmkit = new ColumnConfig("nama_pembangkit", "Nama Pembangkit", 250);
	    nmkit.setAlignment(HorizontalAlignment.LEFT);
	    
	    ColumnConfig nmpic = new ColumnConfig("nama_pic", "Nama PIC", 120);
	    nmpic.setAlignment(HorizontalAlignment.LEFT);
	    
	    ColumnConfig alamat = new ColumnConfig("alamat", "Alamat", 100);
	    alamat.setAlignment(HorizontalAlignment.LEFT);
	    
	    ColumnConfig pemilik = new ColumnConfig("kepemilikan", "Pemilik", 100);
	    pemilik.setAlignment(HorizontalAlignment.LEFT);
	    
	    ColumnConfig wilayah = new ColumnConfig("wilayah", "Wilayah", 130);
	    wilayah.setAlignment(HorizontalAlignment.LEFT);
	    
	    ColumnConfig jeniskit = new ColumnConfig("jenis_pembangkit", "Jenis Pembangkit", 130);
	    jeniskit.setAlignment(HorizontalAlignment.LEFT);
	    
	    ColumnConfig tlp = new ColumnConfig("telp", "Telp", 130);
	    tlp.setAlignment(HorizontalAlignment.LEFT);
	    
	    ColumnConfig daya = new ColumnConfig("daya_terpasang", "Daya Terpasang", 130);
	    daya.setAlignment(HorizontalAlignment.LEFT);
	    
	    ColumnConfig sfc = new ColumnConfig("sfc", "SFC", 130);
	    sfc.setAlignment(HorizontalAlignment.LEFT);
	    
	    ColumnConfig capacity_F = new ColumnConfig("capacity_factor", "Capacity Factor", 130);
	    capacity_F.setAlignment(HorizontalAlignment.LEFT);
	    
	    ColumnConfig hear_rate = new ColumnConfig("heat_rate", "Heat Rate", 130);
	    hear_rate.setAlignment(HorizontalAlignment.LEFT);
	    
	    columns.add(nmkit);
	    columns.add(jeniskit);
	    columns.add(daya);
	    columns.add(pemilik);
	    columns.add(alamat);
	    columns.add(wilayah);
	    columns.add(nmpic);
	    columns.add(sfc);
	    columns.add(capacity_F);
	    columns.add(hear_rate); 
	  
	    final ColumnModel cm = new ColumnModel(columns);
	    
	    gridkit = new Grid<BbMstPembangkitBean>(store1, cm);
	    gridkit.setBorders(true); 
    
    return gridkit;   
	  }
	  
	  private Grid<BbMasterPemasokBean> createGrid() {  
	    
//		  final List<ColumnConfig> columns = new ArrayList<ColumnConfig>(); 
		    
		  store = new ListStore<BbMasterPemasokBean>();
		  getdataPemasok();
		  
		  
		  RowNumberer rn = new RowNumberer();  
		  rn.setWidth(30);
		    
//		    buat column fix
//		    volume.setFixed(true);
//		    volume.setGroupable(false);
//		    volume.setMenuDisabled(true);
//		    volume.setResizable(false);
//		    volume.setSortable(false);
		    
		  idpltu.setId("id_pltu");
		    idpltu.setHeader("PLTU");
		    idpltu.setWidth(150);
		    idpltu.setAlignment(HorizontalAlignment.LEFT);
		    idpltu.setHidden(true);
		    
			idpemasok.setId("id_pemasok");
			idpemasok.setHeader("Pemasok");
			idpemasok.setWidth(150);
			idpemasok.setAlignment(HorizontalAlignment.LEFT);
		    
		    kebtahun.setId("keb_pertahun");
		    kebtahun.setHeader("Kebutuhan / Tahun");
		    kebtahun.setWidth(150);
		    kebtahun.setAlignment(HorizontalAlignment.LEFT);
		    
		    lot.setId("lot");
		    lot.setHeader("Lot");
		    lot.setWidth(150);
		    lot.setAlignment(HorizontalAlignment.LEFT);
		    
		    nopjbb.setId("no_pjbb");
		    nopjbb.setHeader("No PJBB");
		    nopjbb.setWidth(150);
		    nopjbb.setAlignment(HorizontalAlignment.LEFT);

		    tglpjbb.setId("tgl_pjbb");
		    tglpjbb.setHeader("Tanggal PJBB");
		    tglpjbb.setWidth(150);
		    tglpjbb.setAlignment(HorizontalAlignment.LEFT);
		    
		    volpjbb.setId("vol_pjbb");
		    volpjbb.setHeader("Volume PJBB");
		    volpjbb.setWidth(150);
		    volpjbb.setAlignment(HorizontalAlignment.LEFT);
		    
		    volpjbbtahun.setId("vol_pjbb_tahun");
		    volpjbbtahun.setHeader("Volume PJBB Tahun");
		    volpjbbtahun.setWidth(150);
		    volpjbbtahun.setAlignment(HorizontalAlignment.LEFT);
		    
		    hargarpton.setId("harga_rp_ton");
		    hargarpton.setHeader("Harga Rp Ton");
		    hargarpton.setWidth(150);
		    hargarpton.setAlignment(HorizontalAlignment.LEFT);
		    
		    hargapenyesuaian.setId("harga_penyesuaian");
		    hargapenyesuaian.setHeader("Harga Penyesuain");
		    hargapenyesuaian.setWidth(150);
		    hargapenyesuaian.setAlignment(HorizontalAlignment.LEFT);
		    
		    rpnilaikontrak.setId("rp_nilai_kontrak");
		    rpnilaikontrak.setHeader("Rp Nilai Kontrak");
		    rpnilaikontrak.setWidth(150);
		    rpnilaikontrak.setAlignment(HorizontalAlignment.LEFT);
		    
		    kalori.setId("kalori");
		    kalori.setHeader("Kalori");
		    kalori.setWidth(150);
		    kalori.setAlignment(HorizontalAlignment.LEFT);
		    
		    masaberlaku.setId("masa_berlaku");
		    masaberlaku.setHeader("Masa Berlaku");
		    masaberlaku.setWidth(150);
		    masaberlaku.setAlignment(HorizontalAlignment.LEFT);
		    
		    jenispengiriman.setId("jenis_pengiriman");
		    jenispengiriman.setHeader("Jenis Pengiriman");
		    jenispengiriman.setWidth(150);
		    jenispengiriman.setAlignment(HorizontalAlignment.LEFT);
		    
		    jaminanbank.setId("jaminan_bank");
		    jaminanbank.setHeader("Jaminan Bank");
		    jaminanbank.setWidth(150);
		    jaminanbank.setAlignment(HorizontalAlignment.LEFT);
		    
		    ket.setId("keterangan");
		    ket.setHeader("Keterangan");
		    ket.setWidth(150);
		    ket.setAlignment(HorizontalAlignment.LEFT);
			
			
			columns.add(rn);
			columns.add(idpltu);
			columns.add(idpemasok);
			columns.add(kebtahun);
			columns.add(lot);
			columns.add(nopjbb);
			columns.add(tglpjbb);
			columns.add(volpjbb);
			columns.add(volpjbbtahun);
			columns.add(hargarpton);
			columns.add(hargapenyesuaian);
			columns.add(rpnilaikontrak);
			columns.add(kalori);
			columns.add(masaberlaku);
			columns.add(jenispengiriman);
			columns.add(jaminanbank);
			columns.add(ket);
		  
		    final ColumnModel cm = new ColumnModel(columns);
		    
		    grid = new Grid<BbMasterPemasokBean>(store, cm);
		    grid.setBorders(true);  
	    
	    return grid;  
	  }  
	  
	  private Grid<BbMasterPemasokBean> createGrid1() {  
		    
		  	store2 = new ListStore<BbMasterPemasokBean>();
		  	getdataPemasok();
		  
		    RowNumberer rn = new RowNumberer();  
		    rn.setWidth(30);
		    
		    idpltu.setId("id_pltu");
		    idpltu.setHeader("PLTU");
		    idpltu.setWidth(150);
		    idpltu.setAlignment(HorizontalAlignment.LEFT);
		    idpltu.setHidden(true);
		    
			idpemasok.setId("id_pemasok");
			idpemasok.setHeader("Pemasok");
			idpemasok.setWidth(150);
			idpemasok.setAlignment(HorizontalAlignment.LEFT);
		    
		    kebtahun.setId("keb_pertahun");
		    kebtahun.setHeader("Kebutuhan / Tahun");
		    kebtahun.setWidth(150);
		    kebtahun.setAlignment(HorizontalAlignment.LEFT);
		    
		    lot.setId("lot");
		    lot.setHeader("Lot");
		    lot.setWidth(150);
		    lot.setAlignment(HorizontalAlignment.LEFT);
		    
		    nopjbb.setId("no_pjbb");
		    nopjbb.setHeader("No PJBB");
		    nopjbb.setWidth(150);
		    nopjbb.setAlignment(HorizontalAlignment.LEFT);

		    tglpjbb.setId("tgl_pjbb");
		    tglpjbb.setHeader("Tanggal PJBB");
		    tglpjbb.setWidth(150);
		    tglpjbb.setAlignment(HorizontalAlignment.LEFT);
		    
		    volpjbb.setId("vol_pjbb");
		    volpjbb.setHeader("Volume PJBB");
		    volpjbb.setWidth(150);
		    volpjbb.setAlignment(HorizontalAlignment.LEFT);
		    
		    volpjbbtahun.setId("vol_pjbb_tahun");
		    volpjbbtahun.setHeader("Volume PJBB Tahun");
		    volpjbbtahun.setWidth(150);
		    volpjbbtahun.setAlignment(HorizontalAlignment.LEFT);
		    
		    hargarpton.setId("harga_rp_ton");
		    hargarpton.setHeader("Harga Rp Ton");
		    hargarpton.setWidth(150);
		    hargarpton.setAlignment(HorizontalAlignment.LEFT);
		    
		    hargapenyesuaian.setId("harga_penyesuaian");
		    hargapenyesuaian.setHeader("Harga Penyesuain");
		    hargapenyesuaian.setWidth(150);
		    hargapenyesuaian.setAlignment(HorizontalAlignment.LEFT);
		    
		    rpnilaikontrak.setId("rp_nilai_kontrak");
		    rpnilaikontrak.setHeader("Rp Nilai Kontrak");
		    rpnilaikontrak.setWidth(150);
		    rpnilaikontrak.setAlignment(HorizontalAlignment.LEFT);
		    
		    kalori.setId("kalori");
		    kalori.setHeader("Kalori");
		    kalori.setWidth(150);
		    kalori.setAlignment(HorizontalAlignment.LEFT);
		    
		    masaberlaku.setId("masa_berlaku");
		    masaberlaku.setHeader("Masa Berlaku");
		    masaberlaku.setWidth(150);
		    masaberlaku.setAlignment(HorizontalAlignment.LEFT);
		    
		    jenispengiriman.setId("jenis_pengiriman");
		    jenispengiriman.setHeader("Jenis Pengiriman");
		    jenispengiriman.setWidth(150);
		    jenispengiriman.setAlignment(HorizontalAlignment.LEFT);
		    
		    jaminanbank.setId("jaminan_bank");
		    jaminanbank.setHeader("Jaminan Bank");
		    jaminanbank.setWidth(150);
		    jaminanbank.setAlignment(HorizontalAlignment.LEFT);
		    
		    ket.setId("keterangan");
		    ket.setHeader("Keterangan");
		    ket.setWidth(150);
		    ket.setAlignment(HorizontalAlignment.LEFT);
			
			
			columns.add(rn);
			columns.add(idpltu);
			columns.add(idpemasok);
			columns.add(kebtahun);
			columns.add(lot);
			columns.add(nopjbb);
			columns.add(tglpjbb);
			columns.add(volpjbb);
			columns.add(volpjbbtahun);
			columns.add(hargarpton);
			columns.add(hargapenyesuaian);
			columns.add(rpnilaikontrak);
			columns.add(kalori);
			columns.add(masaberlaku);
			columns.add(jenispengiriman);
			columns.add(jaminanbank);
			columns.add(ket);
		  
		    final ColumnModel cm = new ColumnModel(columns);
		    
		    grid1 = new Grid<BbMasterPemasokBean>(store2, cm);
		    grid1.setBorders(true);  
		    
		    return grid1;  
		  }  
	  
	  private Grid<BbMasterPemasokBean> createGrid2() {  
		    
		  store3 = new ListStore<BbMasterPemasokBean>();
		  getdataPemasok();
		  
		    RowNumberer rn = new RowNumberer();  
		    rn.setWidth(30);
		    
		    idpltu.setId("id_pltu");
		    idpltu.setHeader("PLTU");
		    idpltu.setWidth(150);
		    idpltu.setAlignment(HorizontalAlignment.LEFT);
		    idpltu.setHidden(true);
		    
			idpemasok.setId("id_pemasok");
			idpemasok.setHeader("Pemasok");
			idpemasok.setWidth(150);
			idpemasok.setAlignment(HorizontalAlignment.LEFT);
		    
		    kebtahun.setId("keb_pertahun");
		    kebtahun.setHeader("Kebutuhan / Tahun");
		    kebtahun.setWidth(150);
		    kebtahun.setAlignment(HorizontalAlignment.LEFT);
		    
		    lot.setId("lot");
		    lot.setHeader("Lot");
		    lot.setWidth(150);
		    lot.setAlignment(HorizontalAlignment.LEFT);
		    
		    nopjbb.setId("no_pjbb");
		    nopjbb.setHeader("No PJBB");
		    nopjbb.setWidth(150);
		    nopjbb.setAlignment(HorizontalAlignment.LEFT);

		    tglpjbb.setId("tgl_pjbb");
		    tglpjbb.setHeader("Tanggal PJBB");
		    tglpjbb.setWidth(150);
		    tglpjbb.setAlignment(HorizontalAlignment.LEFT);
		    
		    volpjbb.setId("vol_pjbb");
		    volpjbb.setHeader("Volume PJBB");
		    volpjbb.setWidth(150);
		    volpjbb.setAlignment(HorizontalAlignment.LEFT);
		    
		    volpjbbtahun.setId("vol_pjbb_tahun");
		    volpjbbtahun.setHeader("Volume PJBB Tahun");
		    volpjbbtahun.setWidth(150);
		    volpjbbtahun.setAlignment(HorizontalAlignment.LEFT);
		    
		    hargarpton.setId("harga_rp_ton");
		    hargarpton.setHeader("Harga Rp Ton");
		    hargarpton.setWidth(150);
		    hargarpton.setAlignment(HorizontalAlignment.LEFT);
		    
		    hargapenyesuaian.setId("harga_penyesuaian");
		    hargapenyesuaian.setHeader("Harga Penyesuain");
		    hargapenyesuaian.setWidth(150);
		    hargapenyesuaian.setAlignment(HorizontalAlignment.LEFT);
		    
		    rpnilaikontrak.setId("rp_nilai_kontrak");
		    rpnilaikontrak.setHeader("Rp Nilai Kontrak");
		    rpnilaikontrak.setWidth(150);
		    rpnilaikontrak.setAlignment(HorizontalAlignment.LEFT);
		    
		    kalori.setId("kalori");
		    kalori.setHeader("Kalori");
		    kalori.setWidth(150);
		    kalori.setAlignment(HorizontalAlignment.LEFT);
		    
		    masaberlaku.setId("masa_berlaku");
		    masaberlaku.setHeader("Masa Berlaku");
		    masaberlaku.setWidth(150);
		    masaberlaku.setAlignment(HorizontalAlignment.LEFT);
		    
		    jenispengiriman.setId("jenis_pengiriman");
		    jenispengiriman.setHeader("Jenis Pengiriman");
		    jenispengiriman.setWidth(150);
		    jenispengiriman.setAlignment(HorizontalAlignment.LEFT);
		    
		    jaminanbank.setId("jaminan_bank");
		    jaminanbank.setHeader("Jaminan Bank");
		    jaminanbank.setWidth(150);
		    jaminanbank.setAlignment(HorizontalAlignment.LEFT);
		    
		    ket.setId("keterangan");
		    ket.setHeader("Keterangan");
		    ket.setWidth(150);
		    ket.setAlignment(HorizontalAlignment.LEFT);
			
			
			columns.add(rn);
			columns.add(idpltu);
			columns.add(idpemasok);
			columns.add(kebtahun);
			columns.add(lot);
			columns.add(nopjbb);
			columns.add(tglpjbb);
			columns.add(volpjbb);
			columns.add(volpjbbtahun);
			columns.add(hargarpton);
			columns.add(hargapenyesuaian);
			columns.add(rpnilaikontrak);
			columns.add(kalori);
			columns.add(masaberlaku);
			columns.add(jenispengiriman);
			columns.add(jaminanbank);
			columns.add(ket);
		  
		    final ColumnModel cm = new ColumnModel(columns);
		    
		    grid2 = new Grid<BbMasterPemasokBean>(store3, cm);
		    grid2.setBorders(true);  
		    
		    return grid2;  
		  }  
	  
	  private void getdataKit() {
		  GWT.log("MASUK DATA GET DATA Kit",null);
		  datakit = new ArrayList<BbMstPembangkitBean>();
		  	rkapService.getkitall(new AsyncCallback<List<BbMstPembangkitBean>>() {
						public void onFailure(Throwable caught) {
							GWT.log(caught.getMessage(), null);
						}

						public void onSuccess(List<BbMstPembangkitBean> result) {
//							GWT.log("ep total : " + result.size(),null);
//							System.out.println("ep total : " + result.size());
							for (int i = 0; i < result.size(); i++) {
								datakit.add(new BbMstPembangkitBean(
										result.get(i).getId_pltu(),
										result.get(i).getNama_pembangkit(),
										result.get(i).getNama_pic(),
										result.get(i).getAlamat(),
										result.get(i).getKepemilikan(),
										result.get(i).getLatitude(),
										result.get(i).getLongitude(),
										result.get(i).getWilayah(),
										result.get(i).getJenis_pembangkit(),
										result.get(i).getTelp(),
										result.get(i).getDaya_terpasang(),
										result.get(i).getSfc(),
										result.get(i).getCapacity_factor(),
										result.get(i).getHeat_rate(),
										result.get(i).getCreateby(),
										result.get(i).getCreatedate(),
										result.get(i).getUpdateby(),
										result.get(i).getUpdatedate(),
										result.get(i).getApp_access()));
							}
							store1.add(datakit);
							gridkit.unmask();
							GWT.log("grid Kit : " + datakit.size(), null);
							
						}
					});

	  }
	  
	  private void getdataPemasok() {
		  GWT.log("MASUK DATA GET DATA Pemasok",null);
		  datapemasok = new ArrayList<BbMasterPemasokBean>();
		  	rkapService.getpemasokall(new AsyncCallback<List<BbMasterPemasokBean>>() {
						public void onFailure(Throwable caught) {
							GWT.log(caught.getMessage(), null);
						}

						public void onSuccess(List<BbMasterPemasokBean> result) {
//							GWT.log("ep total : " + result.size(),null);
//							System.out.println("ep total : " + result.size());
							for (int i = 0; i < result.size(); i++) {
								datapemasok.add(new BbMasterPemasokBean(
										result.get(i).getId_pjbb(),
										result.get(i).getId_jenis_kontrak(),
										result.get(i).getId_pemasok(),
										result.get(i).getId_pltu(),
										result.get(i).getTahun(),
										result.get(i).getNo_pjbb(),
										result.get(i).getTgl_pjbb(),
										result.get(i).getLot(),
										result.get(i).getKeb_pertahun(),
										result.get(i).getVol_pjbb(),
										result.get(i).getVol_pjbb_tahun(),
										result.get(i).getHarga_rp_ton(),
										result.get(i).getHarga_penyesuaian(),
										result.get(i).getRp_nilai_kontrak(),
										result.get(i).getKalori(),
										result.get(i).getMasa_berlaku(),
										result.get(i).getKeterangan(),
										result.get(i).getJenis_pengiriman(),
										result.get(i).getJaminan_bank(),
										result.get(i).getCreateby(),
										result.get(i).getCreatedate(),
										result.get(i).getUpdateby(),
										result.get(i).getUpdatedate(),
										result.get(i).getApp_access()));
							}
							store.add(datapemasok);
							store2.add(datapemasok);
							store3.add(datapemasok);
							grid.unmask();
							GWT.log("grid Pemasok : " + datapemasok.size(), null);
							
						}
					});

	  }
}